/**
 * @Author: Liu, Yunfeng
 * @DateTime: 2021/7/24 19:17
 * @Description: TODO
 */
public class maximumTime {
    public static String maximumTime(String time) {
        if (time == null) {
            return null;
        }
        StringBuilder sb = new StringBuilder();
        char[] chars = time.toCharArray();
        if (chars[0] == '?') {
            if (chars[1] == '?') {
                chars[0] = '2';
                chars[1] = '3';
            } else {
                chars[0] = time.charAt(1) > '3' ? '1' : '2';
            }
        } else {
            if(chars[1] == '?') {
                chars[1] = chars[0] < '2' ? '9' : '3';
            }
        }

        if (chars[3] == '?') {
            chars[3] = '5';
        }
        if (chars[4] == '?') {
            chars[4] = '9';
        }
        return String.valueOf(chars);
    }

    public static void main(String[] args) {
        System.out.println(maximumTime("00:01"));
    }
}
